import axios, { AxiosRequestConfig } from 'axios'

import { INotice, INoticeListReq } from '../interface'
import './__mock__'

/** 获取通知列表 */
export const apiGetNoticeList = async (
  req: INoticeListReq,
  signal?: AxiosRequestConfig['signal'],
): Promise<INotice[]> => {
  return axios.post(`/tmsapi/customer_notice/list`, req, { signal }).then(res => res.$data || [])
}

/** 取消通知 */
export const apiCncelNotice = async (noticeId: number) => {
  await axios.post(`/tmsapi/customer_notice/cancelNotice`, { noticeId })
}
